/**	@version	0.9
*	@author		Tomas Hubik
*/



#include "init.h"
#include "players.h"
#include "gui.h"
#include "units.h"
#include <QtGui>
#include <iostream>
#include <fstream>
#include <string>
#include "widget_score_graph.h"



int main(int argc, char *argv[])
{

	QApplication a( argc, argv );


	game_gui* ggui;

	//loading of game parameters
	if ( !parameters::get_instance()->load_parameters( "parameters.txt" ) )
	{
		QMessageBox::critical( 0, "Parameters error", "Error occured when reading application's parameters file!" );
		return 1;
	}
	else
	{
		ggui = game_gui::get_instance();	
		ggui->get_graphics();
		//loading of unit types
		if ( !prototypes::get_instance()->load_types( "unit_types.txt" ) )
		{
			int r = QMessageBox::warning( 0, "Unit typer error", "Error occured when reading unit types file!", QMessageBox::Ignore | QMessageBox::Abort, QMessageBox::Abort );
			if ( r != 0x00100000 )
			{
				return 2;
			}
		}
	}
	
	players::get_instance()->fill_players();	
	ggui->create_gui();
	ggui->g->show();
	return a.exec();
	
}
